package com.ciwong.epaper.modules.epaper.util;

import com.ciwong.epaper.application.EApplication;
import com.ciwong.epaper.modules.epaper.bean.Module;
import com.ciwong.epaper.util.ESystem;
import com.ciwong.epaper.util.SerializableManager;
import com.ciwong.epaper.util.download.DownLoadInfo;

/**
 * Created by Administrator on 2017/8/17.
 */

public class RepeatKeyUtil {


    /**
     * 获取保存的uuid的key
     *
     * @return
     */
    public static String getUuidSaveKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, int typeMode) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, // saveId对应评分失败的数据库answer的_id  , saveId + ""
                SerializableManager.SerializeKey.SHARE_KEY_UUID_RECORD + typeMode);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取保存的startDate的key
     *
     * @return
     */
    public static String getStartDateSaveKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, int typeMode) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, // saveId对应评分失败的数据库answer的_id  , saveId + ""
                SerializableManager.SerializeKey.SHARE_KEY_START_DATE + typeMode);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取做作业开始时间是否上报的key
     *
     * @return
     */
    public static String getStartDateIsUploadSaveKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, int typeMode) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, // saveId对应评分失败的数据库answer的_id  , saveId + ""
                SerializableManager.SerializeKey.SHARE_KEY_START_DATE_IS_UPLOAD + typeMode);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取保存的uuid的key
     *
     * @return
     */
    public static String getWordUuidSaveKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, int typeMode) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, // saveId对应评分失败的数据库answer的_id  , saveId + ""
                SerializableManager.SerializeKey.SHARE_KEY_UUID_RECORD_WORD + typeMode);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }


    /**
     * 获取句子缓存答案key
     *
     * @return
     */
    public static String getSaveRepeatAnswerListKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_SENTENCE_RECORD);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }


    /**
     * 获取句子提交状态
     *
     * @return
     */
    public static String getSaveSentenceRepeatStatueKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_SENTENCE_STATE);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }


    /**
     * 获取句子缓存答案key
     *
     * @return
     */
    public static String getWordRepeatAnswerListKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_ANSWER_RECORD);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取句子缓存答案key
     *
     * @return
     */
    public static String getWordRepeatRecordListKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_DO_WORK_RECORD);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }


    /**
     * 获取线上作答缓存答案key
     *
     * @return
     */
    public static String getOnlineAnswerListKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_ONLINE_ANSWER_RECORD);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }


    /**
     * 获取线上作答缓存答案key
     *
     * @return
     */
    public static String getOnlineCommitAnswerListKey(DownLoadInfo downLoadInfo, Module module, int position, String intentWorkId, String uuid) {
        String key = ESystem.getSaveRecordKey(downLoadInfo, module, position,
                intentWorkId, uuid,
                SerializableManager.SerializeKey.SHARE_KEY_ONLINE_ANSWER_COMMIT_RECORD);
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取保存的uuid的key
     *
     * @return
     */
    public static String getDubbingUuidSaveKey(String workId, String versionId, String packageId, String cId, int moduleId, int contentId) {
        String key = "";
        key += workId + "_";
        key += versionId + "_";
        key += packageId + "_";
        key += cId + "_";
        key += moduleId + "_";
        key += contentId + "_";
        key += SerializableManager.SerializeKey.SHARE_KEY_UUID_DUBBING;
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

    /**
     * 获取保存的startDate的key
     *
     * @return
     */
    public static String getDubbingStartDateSaveKey(String workId, String versionId, String packageId, String cId, int moduleId, int contentId) {
        String key = "";
        key += workId + "_";
        key += versionId + "_";
        key += packageId + "_";
        key += cId + "_";
        key += moduleId + "_";
        key += contentId + "_";
        key += SerializableManager.SerializeKey.SHARE_KEY_START_DATE;
        return key + "_" + EApplication.getInstance().getUserInfoBase().getUserId();
    }

}
